package com.gyc.simple.sysuser.thread;

public class ThreadSleepWait implements Runnable{
    @Override
    public synchronized void run() {
        while(true){
            System.out.println("自定义线程-----");
            try {
                wait();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public static void main(String[] args){
        ThreadSleepWait threadSleepWait = new ThreadSleepWait();
        Thread t = new Thread(threadSleepWait);
        t.start();

        while (true){


            synchronized (t){
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                t.notify();
                System.out.println("主线程运行。。。。");


            }



        }

    }
}
